home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8550 < prev    next >
Encoding:
Text File  |  1996-08-05  |  856 b   |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: zach.fit.edu!rcs79272
  3. From: rcs79272@zach.fit.edu (Eric Schank /ADVISOR Engle )
  4. Subject: member of same class in definition
  5. Message-ID: <DMvvvt.6qH@zeno.fit.edu>
  6. Sender: news@zeno.fit.edu (USENET NEWS SYSTEM)
  7. Nntp-Posting-Host: zach.fit.edu
  8. Organization: Florida Institute of Technology
  9. Date: Fri, 16 Feb 1996 19:38:17 GMT
  10.  
  11. I would appreciate someone explaining this code sample to me.
  12.  
  13.  
  14. class egg{
  15.     static egg E;
  16.     int i;
  17. public:
  18.     egg(int I) : i(I) {}
  19. };
  20.  
  21. egg egg::E(47);
  22.  
  23.  
  24. When and egg is instantiated and E is created, isn't another
  25. egg created inside of E, and so on...
  26. When does this end?  Wouldn't you use up all your memory
  27. recursively definig members of the same class?
  28.  
  29. Any insight is welcome.
  30.  
  31. Please reply to my email address, as I don't often read 
  32. this news group.
  33.  
  34. Thanks.
  35.  
  36.     Eric Schank
  37.     rcs79272@zach.fit.edu
  38.  
  39.